|
|
|
| |
|
|
|
|
Notice the use of the Variant data type to return an array of items. This is a very efficient way to pass array data among Visual Basic methods. |
|
|
|
|
|
|
|
|
|
|
Now create a new Public Sub called Dump. This writes the trace list to a disk file. Fill in the method with the code from Listing 14.35. |
|
|
|
|
|
|
|
|
Listing 14.35. Coding the Dump method of the TraceObject. |
|
|
|
|
|
|
|
|
Public Sub Dump()
'
' write trace log to file
Dim intFile As Integer
Dim intLoop As Integer
'
intFile = FreeFile
Open trcFileName For Append As intFile
Print #intFile, "***TRACE STACK DUMP***"
Print #intFile, "***DATE: " & Format(Now(), "general date")
Print #intFile, ""
'
For intLoop = trcPointer To 1 Step -1
Print #intFile, vbTab & Format(intLoop, "000") & ": " &
trcStack(intLoop)
Next
'
Print #intFile, ""
Print #intFile, "***EOF"
Close #intFile
'
Exit Sub
'
LocalErr:
Err.Raise vbObjectError + 3, "Trace.Dump", "Can't write trace file [" &
trcFileName & "]"
'
End Sub |
|
|
|
|
|
|
|
|
Finally, create the Public Sub method called Show and enter the code from Listing 14.36. |
|
|
|
|
|
|
|
|
Listing 14.36. Coding the Show method of the TraceObject. |
|
|
|
|
|
|
|
|
Public Sub Show()
'
' show trace log in dialog
'
Dim intLoop As Integer
Dim strMsg As String |
|
|
|
|
|